-
Notifications
You must be signed in to change notification settings - Fork 488
Add tests for Atomics.pause #4147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Testing descriptor property of Atomics.pause | ||
includes: [propertyHelper.js] | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
verifyProperty(Atomics, 'pause', { | ||
enumerable: false, | ||
writable: true, | ||
configurable: true, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Atomics.pause.length is 0. | ||
includes: [propertyHelper.js] | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
verifyProperty(Atomics.pause, 'length', { | ||
value: 0, | ||
enumerable: false, | ||
writable: false, | ||
configurable: true, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Atomics.pause.name is "pause". | ||
includes: [propertyHelper.js] | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
verifyProperty(Atomics.pause, 'name', { | ||
value: 'pause', | ||
enumerable: false, | ||
writable: false, | ||
configurable: true, | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/built-ins/Atomics/pause/negative-iterationnumber-throws.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Atomics.pause throws on negative argument values | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
const values = [ | ||
-1, | ||
Number.MIN_SAFE_INTEGER, | ||
Number.MIN_SAFE_INTEGER - 1 | ||
]; | ||
|
||
for (const v of values) { | ||
assert.throws(RangeError, () => { Atomics.pause(v); }, | ||
`${v} is an illegal iterationNumber`); | ||
} |
32 changes: 32 additions & 0 deletions
32
test/built-ins/Atomics/pause/non-integral-iterationnumber-throws.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (C) 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Atomics.pause throws on non-integral Number argument values | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
const values = [ | ||
true, | ||
false, | ||
null, | ||
42.42, | ||
-42.42, | ||
NaN, | ||
Infinity, | ||
Symbol("foo"), | ||
"bar", | ||
"42", | ||
/baz/, | ||
42n, | ||
{}, | ||
[], | ||
function() {}, | ||
{ valueOf() { return 42; } } | ||
]; | ||
|
||
for (const v of values) { | ||
assert.throws(TypeError, () => { Atomics.pause(v); }, | ||
`${v ? v.toString() : v} is an illegal iterationNumber`); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-ecmascript-standard-built-in-objects | ||
description: Atomics.pause does not implement [[Construct]], is not new-able | ||
info: | | ||
ECMAScript Function Objects | ||
|
||
Built-in function objects that are not identified as constructors do not | ||
implement the [[Construct]] internal method unless otherwise specified in | ||
the description of a particular function. | ||
|
||
sec-evaluatenew | ||
|
||
... | ||
7. If IsConstructor(constructor) is false, throw a TypeError exception. | ||
... | ||
includes: [isConstructor.js] | ||
features: [Reflect.construct, Atomics.pause] | ||
---*/ | ||
|
||
assert.sameValue(isConstructor(Atomics.pause), false, 'isConstructor(Atomics.pause) must return false'); | ||
|
||
assert.throws(TypeError, () => { | ||
new Atomics.pause(); | ||
}); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2024 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-atomics.pause | ||
description: Atomics.pause returns undefined | ||
features: [Atomics.pause] | ||
---*/ | ||
|
||
assert.sameValue(Atomics.pause(), undefined, | ||
'Atomics.pause returns undefined'); | ||
|
||
const values = [ | ||
undefined, | ||
42, | ||
0, | ||
-0, | ||
Number.MAX_SAFE_INTEGER | ||
]; | ||
|
||
for (const v of values) { | ||
assert.sameValue(Atomics.pause(v), undefined, | ||
'Atomics.pause returns undefined'); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.